package com.zhhq.model;

import java.math.BigDecimal;

public class Goods implements Comparable {
    private Long id;

    private String name;

    private BigDecimal price;

    private String description;

    private String previewimg;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name == null ? null : name.trim();
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description == null ? null : description.trim();
    }

    public String getPreviewimg() {
        return previewimg;
    }

    public void setPreviewimg(String previewimg) {
        this.previewimg = previewimg == null ? null : previewimg.trim();
    }

    @Override
    public int compareTo(Object o)
    {
        Goods sdto = (Goods)o;

        BigDecimal otherAge = sdto.getPrice();
        // note: enum-type's comparation depend on types' list order of enum method
        // so, if compared property is enum-type ,then its comparationfollow ObjEnum.objType order


        return this.price.compareTo(otherAge);
    }
}